package com.updesignsz.api.mapper;

import com.updesignsz.commom.entity.Projects;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 项目
 * Creation date 2020-8-8 15:07:53
 */
@Repository
@Mapper
public interface ProjectsMapper {


    @Select({"<script>",
            "select *  from projects ",
            "<where>",
            "<if test=\"type != null\" >AND type = #{type}</if>",
            "<if test=\"name != null\" >AND name like '%${name}%'</if>",
            "AND is_removed = 0",
            "</where>",
            "order by sequence desc, created_date desc",
            "</script>"
    })
    List<Projects> listPageAll(Map<String, Object> map);



    @Select("select * from projects where id = #{id}")
    Projects getById(@Param("id") Integer id);
}